package rules;

import stock.Company;

public class BuyRule11 extends Rule {

	@Override
	public boolean matches(Company company) {
	
		//Negative Week Variation
		boolean negativeVariation1 = ((company.getWeekInfo().get(1)-company.getWeekInfo().get(0)) < 0);
		boolean negativeVariation2 = ((company.getWeekInfo().get(2)-company.getWeekInfo().get(1)) < 0);
		boolean negativeVariation3 = ((company.getWeekInfo().get(3)-company.getWeekInfo().get(2)) < 0);
		boolean negativeVariation4 = ((company.getWeekInfo().get(4)-company.getWeekInfo().get(3)) < 0);
		
		boolean negativeWeekVariation =  (negativeVariation1 && negativeVariation2 && negativeVariation3 && negativeVariation4);
		
		if ( negativeWeekVariation ){
			return this.next(company);
		}else{
			return false;
		}
	}

}
